package com.wpen.unit.web.controller.job;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wpen.unit.service.job.DependonService;
import com.wpen.unit.web.dto.job.DependonAddRequest;
import com.wpen.unit.web.dto.job.DependonAddResponse;
import com.wpen.unit.web.dto.job.DependonBatchListRequest;
import com.wpen.unit.web.dto.job.DependonDelRequest;
import com.wpen.unit.web.dto.job.DependonDelResponse;
import com.wpen.unit.web.dto.job.DependonListRequest;
import com.wpen.unit.web.dto.job.DependonListResponse;
import com.wpen.unit.web.dto.job.DependonMapBatchRequest;
import com.wpen.unit.web.dto.job.DependonMapRequest;
import com.wpen.unit.web.dto.job.DependonMapResponse;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

/**
 * 依赖信息维护
 * 
 * @author pg
 *
 */
@Tag(name = "依赖信息模块服务接口")
@RestController
@RequestMapping("/api")
public class DependonController {
    @Autowired
    private DependonService dependonService;

    @Operation(summary = "依赖信息-列表查询")
    @PostMapping(value = "/dependon/list",produces = MediaType.APPLICATION_JSON_VALUE)
    public DependonListResponse queryListDependon(@RequestBody @Valid DependonListRequest dependonListRequest ) {
        return dependonService.queryListDependon(dependonListRequest);
    }
    
    @Operation(summary = "依赖信息-批次列表查询")
    @PostMapping(value = "/dependon/batch-list",produces = MediaType.APPLICATION_JSON_VALUE)
    public DependonListResponse queryBatchListDependon(@RequestBody @Valid DependonBatchListRequest dependonListRequest ) {
        return dependonService.queryBatchListDependon(dependonListRequest);
    }

    @Operation(summary = "依赖信息-新增")
    @PostMapping(value = "/dependon/add",produces = MediaType.APPLICATION_JSON_VALUE)
    public DependonAddResponse addDependon(@RequestBody @Valid DependonAddRequest dependonAddRequest ) {
        return dependonService.addDependon(dependonAddRequest);
    }


    @Operation(summary = "依赖信息-删除")
    @PostMapping(value = "/dependon/del",produces = MediaType.APPLICATION_JSON_VALUE)
    public DependonDelResponse delDependon(@RequestBody @Valid DependonDelRequest dependonDelRequest ) {
        return dependonService.delDependon(dependonDelRequest);
    }

    @Operation(summary = "依赖进行图-查询")
    @PostMapping(value = "/dependon/map",produces = MediaType.APPLICATION_JSON_VALUE)
    public DependonMapResponse queryMapDependon(@RequestBody @Valid DependonMapRequest dependonMapRequest ) {
        return dependonService.queryMapDependon(dependonMapRequest);
    }
    
    @Operation(summary = "依赖进行图-批次-查询")
    @PostMapping(value = "/dependon/batch-map",produces = MediaType.APPLICATION_JSON_VALUE)
    public DependonMapResponse queryBatchMapDependon(@RequestBody @Valid DependonMapBatchRequest dependonMapRequest ) {
        return dependonService.queryBatchMapDependon(dependonMapRequest);
    }
}
